Powerbullet animation file format


The Powerbullet animation file format consists of an array of 12 decimal numbers. Each Row represents a step in the animation.

The first row is the start position (or state) of the element. The last row is the resting position of the element. This usually would have neutral settings - that is, the objet should not be transformed so it finishes in the position specified during design.

So the simplest animation wouild have two steps: the start position and the end position.

There is a "magic" number that - when used - causes a calculation based on the display size and the size of the sprite (text box, image etc) being animated. It is (+-) 32767. When -32767 is used on the X (horizontal) position, it ensures the animated object is offstage left; for the Y (vertical) position, it specifies offstage top. Likewise the positive version, 32767 means offstage right (X) or offstage bottom (Y).

Example:

For a line of text or whatever to zoom in from the left and stop at its natural position in the layout (as viewed in the Powerbullet window), the minimum data required would be two lines.

X Y rotate skew2 scaleX scaleY red green blue alpha flags frame
-32767 0 0 0 1 1 0 0 0 0 0 1
0 0 0 0 1 1 0 0 0 0 0 10

In the above example, the animation consists of 10 frames (1-10). The selected item is animated by setting its starting position offstage left (its XY coordinates are stage left (0.0) minus the width of the item (ensuring it is invisible at the start), and moving it to whatever its position in the layour is - over 10 frames. Frame numbers are absolute, not relative, so each row must have a frame greater than the previous. The frames do not have to start at 1. If they start later, it simply introduces a delay. This is unlikely to be useful, however, as the user can specify a delay (in seconds) in the animation settings dialog box.

Column: Item:

1 Horizontal (X) position

2 Vertical (Y) position

3 Rotation in degrees - or Rotate/skew 1 if flags (see below) include "skew"

4 Rotate/skew 2 if flags include "skew", otherwise ignored

5 Horizontal scale

6 Vertical scale

7 Color red component

8 Color green component

9 Color blue component

10 Color alpa component

11 Flags

12 Frame for this data

Flags:

1 Color multiply - it means the values in RGBA are multimplied, otherwise they are added

2 Skew - it means parameters 3 and 4 represent Skew 1 and Skew 2, otherwise parameter 3 is rotation and is ignored.

In programming terms, flags are bits of a (usually) 32 bit word that are switched on or off. The mechanism for doing this in programming is ORing them (same as the bitwise OR operation in electronics). In more general terms, predefined values - each one representing one of the conditions - are added together.

Currently there are only two meaningful flags: 1 and two. So providing a value of (1+2) 3 means that multiply and skew apply to the appropriate parameter values.

Color animation:

Colors can be animated either by addition or multiplication. The values map to the Flash Player's internal Color Transformation Matrix. When using add (which is the default unless the Multiply flag is set) the numbers are offsets to the animation item's setting in the layout. So if a shape is Opaque Red (and RGBA quadruple of 255, 0, 0, 255), and a color value is set to [-127, 0, 0, 0], the result will be to decrease the red value by 127, resulting in 128 - a darker red. The resulting color values are clamped by the Flash Player, so a color calculation result of -27 will be 0. Multiplication is handled by a similar pronciple, but permits more radical changes, such as exponential color shifts.

Numbering system:

The numbering system follows that of the SWF file format.

While all the numbers in the file format are decimal for simplicity, they represent differing numbering systems and scaling systems internally, depending on their functionality.

The X and Y parameters are in TWIPS. There are 20 TWIPS to a pixel, so screen coordinate 100 is 2000. Rotation by default is in degrees, and column 4 is ignored. When the Skew flag is set, column 3 and 4 specify the rotate/skew values in TWIPS. This is an advanced setting, and requires a little knowledge of 2D matrix math to get predictable results. Scale is decimal, and no scaling is defined by unity, or 1.0. The color values Red, Green. Blue and the transparency setting Alpha are 8 bit numeric scales (0-0xFF or 0-255, so an Aplha setting of 255.0 means fully opaque, whereas 0.0 is fully transparent. Note that additions and multiplications are not limited to positive 8 bit numbers, but the result will be clampled to a positive 8 bit range (0-255). The Frame Number is an integer. Fractional portions will be ignored, but it is recommended that you set it to zero in case it is used in the future for any reason. Frame numbers must increase with rows. The Flags field is treated as a bitfield. Currently there are only 3 valid values: 0, 1 and 2. In future the fractional portion may be converted to another integer bitfield, so please always set this to zero.